package com.stridercheng.myjd.tools;

import android.graphics.Bitmap;

import com.nostra13.universalimageloader.core.assist.LoadedFrom;
import com.nostra13.universalimageloader.core.display.BitmapDisplayer;
import com.nostra13.universalimageloader.core.imageaware.ImageAware;

/**
 * deiscription:
 * User: stridercheng
 * Date: 2015-07-12
 * Time: 14:08
 * FIXME
 */
public class SimpleImageDisplayer implements BitmapDisplayer {
    private int targetWidth;

    public SimpleImageDisplayer(int targetWidth) {
        this.targetWidth = targetWidth;
    }


    @Override
    public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
        if (bitmap != null) {
            bitmap = ImageUtils.resizeImageByWidth(bitmap, targetWidth);
            imageAware.setImageBitmap(bitmap);
        }
    }
}
